import redis
import logging

class AppBaseConfig():

    """
        session
    """
    DEBUG = True
    SECRET_KEY = '1615bfc4-0424-4034-be1a-36b470a54faf'

    # mysql数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:1234@localhost:3306/web_xj_project'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis连接配置
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379
    REDIS_PWD = ''

    # SESSION的配置
    SESSION_TYPE = 'redis' # 指明向redis中存入session
    SESSION_USE_SINGER = True # 加密
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT,password=REDIS_PWD)
    PERMANENT_SESSION_LIFETIME = 3600 * 24  # 有效时间

    # logging的级别
    LOGGING_LEVER = logging.DEBUG


class AppDevelopCogfig(AppBaseConfig):
    pass

class AppProductCogfig(AppBaseConfig):
    DEBUG = False

class AppTestCogfig(AppBaseConfig):
    pass

app_config_dict = dict(
    develop = AppDevelopCogfig,
    product = AppProductCogfig,
    test = AppTestCogfig,
)

class RedisSessionConfig():
    HOST = 'localhost'
    PORT = 6379
    DB = 1
    DECODE = True
    IMAGE_CODE_EX = 60 * 2
    IMAGE_PREFIX = 'image_code_'
    TEL_CODE_EX = 60 * 5
    TEL_PREFIX = 'tel_code_'


class SmsConfig():
    USERID = 'E107GL'
    PWD = '96fQ9G'
    URL = 'http://api02.monyun.cn:7901/sms/v2/std/'

class UploadImageConfig():
    ALLOWED_EXTENSIONS = ['.png','.jpg']
    ALLOWED_SIZE = 1024*1024*2
if __name__ == '__main__':
    pass